<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <input type="text">
</body>
<script>
    let inp = document.querySelector('input');
    console.log(inp);
    let isComposition = false
    function search() {
        console.log(inp.value)
    }
    inp.addEventListener('input', () => {
        if (!isComposition) {
            search()
        }
    })

    inp.addEventListener('compositionstart', () => {
        console.log('合成开始')
        isComposition = true;
    })
    inp.addEventListener('compositionend', () => {
        console.log('end')
        isComposition = false
        search()
    })
</script>

</html>